package com.lagou.edu.service.impl;

import com.lagou.edu.dao.AuthDao;
import com.lagou.edu.pojo.Auth;
import com.lagou.edu.service.AuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

@Service
@Transactional
public class AuthServiceImpl implements AuthService {
    @Autowired
    private AuthDao authDao;

    @Override
    public Boolean findByEmailAndExpire(String email) {
        Date expire = new Date();
        List<Auth> aList = authDao.findByEmailAndExpire(email, expire);
        if (aList != null && aList.size() == 1) {
            return true;
        }
        return false;
    }
}
